import http from '@/request/request'

// 获取用户信息
export function login(userInfo) {
    return http({
        url: '/user/login',
        method: 'post',
        data: userInfo,
    })
}


// 获取用户列表
export function getUserList(page, size) {
    return http({
        url: `/user/list?page=${page}&&size=${size}`,
        method: 'get',
    })
}

// 删除用户
export function deleteById(userId) {
    return http({
        url: `/user/del`,
        method: 'post',
        data: userId
    })
}


// 根据用户姓名查询
export function search(campusId, deptId, username) {
    campusId = campusId === undefined ? '' : campusId;
    deptId = deptId === undefined ? '' : deptId;
    username = username === undefined ? '' : username;
    return http({
        url: `/user/search?campusId=${campusId}&deptId=${deptId}&username=${username}`,
        method: 'get',
    })
}

// 添加用户
export function add(userInfo) {
    return http({
        url: '/user/add',
        method: 'post',
        data: userInfo,
    })
}

// 更新用户
export function update(userInfo) {
    return http({
        url: '/user/update',
        method: 'post',
        data: userInfo,
    })
}
